<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@ page import="java.util.ArrayList" %>
<%@ include file="../tld/tlds.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>信息管理</title>
<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {font-size: 12px;}
.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;

}
a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.STYLE7 {font-size: 12px;}

</style>
<script type="text/javascript" src="js/meihuaxue.js"></script>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/submit.js"></script>
       
<script type="text/javascript">
 function sa(channelid){
   iframe1.location = "tree.jsp?channelid="+channelid; 
 }  
</script>
</head>
<%
Admin admin=(Admin)request.getSession().getAttribute("admin");
%>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="images/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="images/tab_05.gif"><img src="images/311.gif" width="16" height="16" />
			<span class="STYLE4">信息管理页面</span></td>
        <td width="281" background="images/tab_05.gif">
        &nbsp;
        </td>
        <td width="14"><img src="images/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="images/tab_12.gif">&nbsp;</td>
        <td bgcolor="#f3ffe3">
        <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
          <td width="20%" height="25" align="center" valign="middle"  bgcolor="#FFFFFF"  class="STYLE1">栏目选择</td>
          <td width="80%" height="25" align="center" valign="middle"  bgcolor="#FFFFFF"  class="STYLE1">栏目管理</td>
        </tr>
        <tr>
          <td height="25"  valign="top" bgcolor="#FFFFFF"  class="STYLE1">
          
              <table width="98%" height="8" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td></td>
                </tr>
              </table>
                <table width="98%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top" class="STYLE1">
                    <%
					if (admin.getRole().getId() == 3 || admin.getRole().getId() == 5 ) {
					%>
		<script type="text/javascript">
                     var tree = new MzTreeView("tree");
                     tree.setIconPath("<%=request.getContextPath()%>/admin/TreeView/"); //可用相对路
                     tree.nodes["0_1"] = "text:所有栏目;method:sa('null');";
					 <%
					 List channellist=new ChannelDAO().findAll();
					 for(int i=0;i<channellist.size();i++)
					 {Channel channel=(Channel)channellist.get(i);

					 %> 
					  
					   tree.nodes["<%=channel.getFatherId()%>_<%=channel.getChannelId()%>"] = "text:<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>;method:sa('<%=channel.getChannelId()%>')";  
					 <%
					   }
					 %>
					 
				   tree.setTarget("MzMain");
				   document.write(tree.toString());    //亦可用 obj.innerHTML = tree.toString();
				 </script>
             <%}else{%>
                <script type="text/javascript">
                     var tree = new MzTreeView("tree");
                     tree.setIconPath("<%=request.getContextPath()%>/admin/TreeView/"); //可用相对路
                     tree.nodes["0_1"] = "text:栏目管理;";
					 <% List channellist=new ArrayList();
					 String hql="from AdminQx where admin.adminId='"+admin.getAdminId()+"'";
					 List qxlist=new AdminQxDAO().getSession().createQuery(hql).list();
					 for(int j=0;j<qxlist.size();j++)
					 {
						 AdminQx qx=(AdminQx)qxlist.get(j);
						 channellist.add(qx.getChannel());
					 }
					 for(int i=0;i<channellist.size();i++)
					 {Channel channel=(Channel)channellist.get(i);
					 %> 
					  
					   tree.nodes["1_<%=channel.getChannelId()%>"] = "text:<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>;method:sa('<%=channel.getChannelId()%>')";  
					 <%
					   }
					 %>
					 
				   tree.setTarget("MzMain");
				   document.write(tree.toString());
				 </script>
				 <%} %>
                    </td>
                  </tr>
                </table>
                <table width="98%" height="8" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td></td>
                  </tr>
                </table>
          
          </td>
        <td height="25" align="left" valign="top" bgcolor="#FFFFFF" style="padding-left:7px"   class="STYLE1">
          <table width="98%" height="8" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td></td>
                  </tr>
                </table>
                  <iframe src="tree.jsp" frameborder="0" marginwidth="0" marginheight="0"  name="iframe1" id="iframe1" width="100%" height="450">
                  </iframe>
                  <table width="98%" height="22" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="22"></td>
                    </tr>
                </table>
          
          
          </td>
          </tr>
          </table>
        </td>
        <td width="9" background="images/tab_16.gif">&nbsp;</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td height="29">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="images/tab_20.gif" width="15" height="29" /></td>
        <td background="images/tab_21.gif">
        &nbsp;</td>
        <td width="14"><img src="images/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<script type="text/javascript">
var message = "<%=session.getAttribute("message")%>";
if(message!=null && message!="null" && message !=""){
   alert(message);
  }
</script>
<%
	session.removeAttribute("message");
%>